package com.zgjkhis.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author yzq
 * @Description 渠道
 * @Date 2021/6/23 9:38
 * @Param
 * @return
 **/
@Data
@TableName("his_base_use")
public class BaseUse implements Serializable {

    @TableId
    private Long id;
    @ApiModelProperty(value = "用法名称")
    @NotNull(message = "用法名称不能为空")
    private String name;
    @ApiModelProperty(value = "创建用户")
    private String createUser;
    @ApiModelProperty(value = "1：基础，2：私有")
    @NotNull(message = "用法类型不能为空")
    private Integer type;
    @ApiModelProperty(value = "0：有效，1：无效")
    @NotNull(message = "用法状态不能为空")
    private Integer status;
    /** 创建时间 */
    @TableField(fill= FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    @ApiModelProperty(value = "药房id",required = true)
    private String pharmacyId;
    @NotNull(message = "使用范围")
    private String useAllClinic;


    public void copy(BaseUse source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
